package cn.caishen.report.common.constant;

import org.apache.poi.ss.formula.functions.Count;

public class LbConstant {

    /**
     * 动态报表标题list
     */
    public static final String TITLE_LIST = "titleList";

    /**
     * 动态报表数据list
     */
    public static final String DATA_LIST = "dataList";

    /**
     * 动态报表行数
     */
    public static final String DATA_COUNT = "dataCount";

    /**
     * 动态报表合计list
     */
    public static final String SUM_LIST = "sumList";

    /**
     * 动态报表条件list
     */
    public static final String WHERE_PARAM_LIST = "whereParamList";

    /**
     * 动态报表条件list
     */
    public static final String REPORT_USER_FIELD_LIST = "reportUserFieldList";

    /**
     * 动态报表排行数量
     */
    public static final Integer REPORT_RANKING_COUNT = 6;
    public static final String RANKING_FIELD = "ranking";
    public static final String RANKING_COUNT_FIELD = "rankingCount";

    /**
     * 动态报表导出文件名称
     */
    public static final String FILE_NAME = "fileName";

    /**
     * 动态报表配置
     */
    public static final String REPORT_CONFIG = "reportConfig";

    public static final String LEFT_REPLACE = "[/";

    public static final String RIGHT_REPLACE = "/]";

    /**
     * 动态报表图形显示x轴坐标
     */
    public final static String AXIS_X = "x";

    /**
     * 动态报表图形显示y轴坐标
     */
    public final static String AXIS_Y = "y";

    /**
     * 动态报表图形显示z轴坐标
     */
    public final static String AXIS_Z = "z";

    public final static Integer CONFIRM_0 = 0;
    public final static Integer CONFIRM_1 = 1;

    /**
     * 比较符号
     */
    public enum COMPARE {
        EQ("等于", 1),
        GT("大于", 2),
        GE("大于等于", 3),
        LT("小于", 4),
        LE("小于等于", 5),
        LIKE("模糊查询", 6),
        IN("包含", 7);

        private int code;
        private String name;

        COMPARE(String name, int code){
            this.name = name;
            this.code = code;
        }

        public int getCode(){
            return code;
        }

        public String getName(){
            return name;
        }
    }

    /**
     * 报表是否显示字段
     */
    public enum ON_SHOW {
        UN_SHOW("unShow", 0),
        SHOW("show", 1);

        private Integer code;
        private String name;

        ON_SHOW(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 字段参数类型，用于前端显示
     */
    public enum PARAM_TYPE {
        DATE("date", 1),
        SELECT("select", 2),
        STRING("string", 3),
        LIST("list", 4),
        TIME("time", 5);

        private Integer code;
        private String name;

        PARAM_TYPE(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        /**
         * 通过code查询名称
         *
         * @param code
         * @return
         */
        public static String getNameByCode(int code) {
            for (PARAM_TYPE status : PARAM_TYPE.values()) {
                if (status.code.equals(code)) {
                    return status.name;
                }
            }
            return "";
        }
    }

    /**
     * 用户类型
     */
    public enum USER_TYPE {
        PLATFORM_ADMIN("平台管理员", 1),
        UNIT_ADMIN("商户管理员", 2),
        UNIT_USER("商户用户", 3);

        private Integer code;
        private String name;

        USER_TYPE(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 数据权限（1-全部，2-个人）
     */
    public enum DATA_PURVIEW {
        ALL_DATA("全部数据", 1),
        CREATOR_DATA("仅查询登录人数据", 2);

        private Integer code;
        private String name;

        DATA_PURVIEW(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * EXCEL字段类型
     */
    public enum EXCEL_FIELD_TYPE {
        STRING("string", 1),
        INTEGER("integer", 2),
        DATE("date", 3);

        private Integer code;
        private String name;

        EXCEL_FIELD_TYPE(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        /**
         * 通过code查询名称
         *
         * @param code
         * @return
         */
        public static String getNameByCode(int code) {
            for (EXCEL_FIELD_TYPE status : EXCEL_FIELD_TYPE.values()) {
                if (status.code.equals(code)) {
                    return status.name;
                }
            }
            return "";
        }
    }

    /**
     * 是否是报表
     */
    public enum IS_REPORT {
        NO_REPORT("不是报表", 0),
        IS_REPORT("是报表", 1);

        private int code;
        private String name;

        IS_REPORT(String name, int code){
            this.name = name;
            this.code = code;
        }

        public int getCode(){
            return code;
        }

        public String getName(){
            return name;
        }
    }

    /**
     * 删除状态
     */
    public enum DELETE_STATUS {
        UN_DELETE("未删除", 0),
        DELETED("已删除", 1);

        private Integer code;
        private String name;

        DELETE_STATUS(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 模块类型
     */
    public enum MODULE_TYPE {
        PLATFORM_MODULE("平台模块", 1),
        UNIT_MODULE("商户模块", 2);

        private Integer code;
        private String name;

        MODULE_TYPE(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


    /**
     * 图形类型（柱状=1,饼状=2,折线=3,排行=4）
     */
    public enum CHART_TYPE {
        HISTOGRAM("柱状图", 1),
        PIE_CHART("饼状图", 2),
        LINE_CHART("折线图", 3),
        RANKING_LIST("排行榜", 4);

        private Integer code;
        private String name;

        CHART_TYPE(String name, Integer code) {
            this.name = name;
            this.code = code;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
